package com.joyoung.control.dialog;

import android.content.Context;
import android.content.DialogInterface;
import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View;

/**
 * 自定义AlertDialogBuilder接口
 *
 * @author qinglinyi
 * @date 2018/6/14
 */
@SuppressWarnings({"all"})
public interface IAlertDialogBuilder {

    IAlertDialogBuilder context(Context context);

    IAlertDialogBuilder title(@NonNull CharSequence title);

    IAlertDialogBuilder content(@NonNull CharSequence content);

    IAlertDialogBuilder positiveText(@NonNull CharSequence text);

    IAlertDialogBuilder negativeText(@NonNull CharSequence text);

    IAlertDialogBuilder neutralText(@NonNull CharSequence text);

    IAlertDialogBuilder items(@NonNull CharSequence... items);

    IAlertDialogBuilder itemsCallback(@NonNull ListCallback callback);

    IAlertDialogBuilder onPositive(@NonNull SingleButtonCallback callback);

    IAlertDialogBuilder onNegative(@NonNull SingleButtonCallback callback);

    IAlertDialogBuilder onNeutral(@NonNull SingleButtonCallback callback);

    IAlertDialogBuilder dismissListener(@NonNull DialogInterface.OnDismissListener onDismissListener);

    IAlertDialogBuilder cancelable(boolean cancelable);

    IAlertDialogBuilder customView(@LayoutRes int layoutRes, boolean wrapInScrollView);

    IAlertDialogBuilder inputType(int type);

    IAlertDialogBuilder input(@Nullable CharSequence hint, @Nullable CharSequence preFill, @NonNull InputCallback callback);

    IAlertDialogBuilder autoDismiss(boolean autoDismiss);

    IAlertDialog build();

    IAlertDialog show();

    IAlertDialog showProgress(Context context, @NonNull CharSequence content);

    interface InputCallback {
        void onInput(@NonNull IAlertDialog dialog, CharSequence input);
    }

    interface ListCallback {
        void onSelection(IAlertDialog dialog, View view, int position, CharSequence text);
    }

    interface SingleButtonCallback {
        void onClick(@NonNull IAlertDialog dialog);
    }
}
